package main

import "fmt"

func main()  {
	//iota 常量自动生成器每隔一行自动累加1
	//只有给常量赋值时才有用
	const (
		a = iota
		b = iota
		c = iota
	)
	fmt.Printf("a = %d, b = %d, c = %d\n", a, b, c)

	//iota在遇到另一个const的时候会重置为0
	const (
		d = iota
	)
	fmt.Printf("d = %d\n", d)

	//可以只写一个iota
	const (
		f = iota
		g
		h
	)
	fmt.Printf("f = %d, g = %d, h = %d\n", f, g, h)

	//如果在同一行值是一样的
	const (
		i = iota
		j, k, l = iota, iota, iota
		m = iota
	)
	fmt.Printf("i = %d, j = %d, k = %d, l = %d, m = %d", i, j, k, l, m)
}
